package render;

import java.awt.Color;
import java.awt.Graphics2D;

public class RenderColorMap extends ColorMap
{
    
    
    
    public RenderColorMap(
            int pixelsWide, 
            int pixelsTall)
    {
        super(
            pixelsWide, 
            pixelsTall
        );
    }
    
    public void renderUpToScanline(
            int scanlineIndexY, 
            Graphics2D g)
    {
        for (int indexY = 0; indexY < scanlineIndexY; indexY++)
        {
            this.renderScanline(indexY, g);
        }
    }
    
    public void renderScanline(
            int indexY, 
            Graphics2D g)
    {
        for (int indexX = 0; indexX < this.numPixelsX; indexX++)
        {
            g.setColor(new Color(
                (float) this.pixels[indexY][indexX][0], 
                (float) this.pixels[indexY][indexX][1], 
                (float) this.pixels[indexY][indexX][2], 
                1.0f
            ));
            g.drawLine(indexX, indexY, indexX, indexY);
        }
    }
    
}
